package com.study.seckill.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * @ClassName: GenerateOrderNum 订单编号的生成
 * @Author: wYin
 * @Date: 2022/3/10 14:29
 */
public class GenerateOrderNum {
    private static final String prefix = "CDXY";//4
    public static String getOrderNum(){
        SimpleDateFormat sim = new SimpleDateFormat("ddHHmmssSS");//10
        String time = sim.format(new Date());
        Random random = new Random();
        int randomNum = random.nextInt(1000) + 100;//3
        return prefix+time+randomNum;
    }
}
